m = n = 9
arr = []

line = '080600390.203004000.900018000.302050008.061040730.000030204.000080003.000200905.024003060'

lines = line.split('.')
t = 0
for line in lines:
    l = []
    for c in line:
        l.append(int(c))
        if int(c) == 0:
            t +=1
    arr.append(l)

for row in lines:
    print(row)

b = [[0] * 3 for _ in range(3)]
r = [0] * 9
c = [0] * 9
for i in range(m):
    for j in range(n):
        k = 1 << arr[i][j]
        b[i // 3][j // 3] |= k
        r[i] |= k
        c[j] |= k

g = [[0] * n for _ in range(n)]
p = (1<<10) - 1
for i in range(m):
    for j in range(n):
        if arr[i][j] == 0:
            g[i][j] = p ^ (b[i//3][j//3] | r[i] | c[j])
while t > 0:
    for i in range(m):
        for j in range(n):
            if arr[i][j] == 0:
                for k in range(1,9):
                    

# queue = []
# for i in range(m):
#     for j in range(n):
#         if g[i][j].bit_count() == 1:
#             k = g[i][j].bit_length() - 1
#             queue.append((i,j,k))
#             arr[i][j] = k
#             g[i][j] = 0
# print(queue)
# while queue:
#     x,y,k = queue.pop()
#     for i in range(n):
#         if g[x][i] != 0 and g[x][i] & (1<<k)!=0:
#             g[x][i]^= 1<<k
#             if g[x][i].bit_count() == 1:
#                 nk = g[x][i].bit_length() - 1
#                 queue.append((x,i,nk))
#                 arr[x][i] = nk
#                 g[x][i] = 0
#     for i in range(m):
#         if g[i][y] != 0 and g[i][y] & (1<<k)!=0:
#             g[i][y]^= 1<<k
#             if g[i][y].bit_count() == 1:
#                 nk = g[i][y].bit_length() - 1
#                 queue.append((i,y,nk))
#                 arr[i][y] = nk
#                 g[i][y] = 0
#     for i in range(3):
#         for j in range(3):
#             x1 ,y1 = 3 * (x//3) + i, 3 * (y//3) + j
#             if g[x1][y1]!=0 and g[x1][y1] & (1<<k)!=0:
#                 g[x1][y1]^= 1<<k
#                 if g[x1][y1].bit_count() == 1:
#                     nk = g[x1][y1].bit_length() - 1
#                     queue.append((x1,y1,nk))
#                     arr[x1][y1] = nk
#                     g[x1][y1] = 0

for row in arr:
    print(row)


